#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>

void compute_during_1ms (int);

void compute_during_1ms (int n )
{
  uint32_t b;
  for (b=0;b<0x8FFFF8;b++)
  {
          printf("");
          fflush( stdout);
  }
}

int gnc_welcome = 1;
int tmtc_welcome = 1;

void update (int* value)
{
        int v;
        v = *value;
        v++;
        *value = v;
        printf ("Value Updated: %d\n", *value);
}

void read (int* value)
{
        printf ("Value read: %d\n", *value);
}

void gnc_job()
{
        printf ("Begin computing : GNC\n");
        compute_during_1ms (600);
        printf ("End Computing : GNC\n");
}

void tmtc_job()
{
        printf ("Begin computing : TMTC\n");
        compute_during_1ms (600);
        printf ("End Computing : TMTC\n");
}

void gnc_identity ()
{
        if (gnc_welcome == 1)
        {
                printf ("Welcome GNC\n");
                gnc_welcome = 0;
        }
        else
        {
                printf ("Good by GNC\n");
                gnc_welcome = 1;
        }
}

void tmtc_identity ()
{
        if (tmtc_welcome == 1)
        {
                printf ("Welcome TMTC\n");
                tmtc_welcome = 0;
        }
        else
        {
                printf ("Good by TMTC\n");
                tmtc_welcome = 1;
        }
}
